import store from '@/store/index'
// 此文件用于配置项和相关参数设置

// 详情展示页
// 基本信息
// 基础信息模块
const detailInfo = [{
  label: '计划名称',
  name: 'planName',
  value: ''
},
{
  label: '计划周期类别',
  name: 'planPeriodType',
  value: ''
},
{
  label: '最新任务时间',
  name: 'recentTaskTime',
  value: ''
},
{
  label: '计划开始时间',
  name: 'dailyStartTime',
  value: ''
},
{
  label: '计划周期',
  name: 'dailyPeriod',
  value: ''
},
{
  label: '跳过周期',
  name: 'dailySkipDays',
  value: ''
},
{
  label: '计划时间',
  name: 'regularStartTime',
  value: ''
},
{
  label: '创建人',
  name: 'createdBy',
  value: ''
},
{
  label: '创建时间',
  name: 'createdTime',
  value: ''
},
{
  label: '最后更新',
  name: 'updateTime',
  value: ''
}
]

const detailShowInfo = { title: '基础信息', content: detailInfo }
const checkDeviceShowInfo = {
  title: '巡检设备',
  content: '',
  showPage: false,
  tableColumns: [
    { type: 'index', label: '序号', width: 140 },
    { prop: 'deviceName', label: '设备名称', minWidth: 180 },

    {
      prop: 'assetNumber',
      label: '设备编号',
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: 'useOrganName',
      label: '使用部门',
      width: 100
    },
    { prop: 'partPicList', label: '巡检部位简图', minWidth: 180 }
  ],
  tableData: []
}
const checkOperateShowInfo = {
  title: '巡检员',
  content: '',
  showPage: false,
  tableColumns: [
    { type: 'index', label: '序号', width: 140 },
    { prop: 'empno', label: '员工编号', minWidth: 180 },

    {
      prop: 'realName',
      label: '姓名',
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: 'phone',
      label: '手机号',
      width: 100
    },
    { prop: 'organName', label: '部门', minWidth: 180 }
  ],
  tableData: []
}
const checkItemsShowInfo = {
  title: '巡检项',
  showPage: false,
  content: '',
  tableColumns: [
    { type: 'index', label: '序号', width: 140 },
    { prop: 'part', label: '巡检部位', minWidth: 180 },

    {
      prop: 'content',
      label: '巡检内容',
      width: 100
      // render: (row) => {
      //   const { deviceInfo } = row;
      //   return deviceInfo.name ? deviceInfo.name :"";
      // },
    },
    {
      prop: 'standard',
      label: '巡检基准',
      width: 100
    },
    { prop: 'method', label: '巡检方法', minWidth: 180 },
    { prop: 'upPicFlag', label: '上传图片', minWidth: 180, filter: 'formatIsNecessary' },
    { prop: 'upVideoFlag', label: '上传视频', minWidth: 180, filter: 'formatIsNecessary' }
  ],
  tableData: []
}
// 基础信息表单配置
const formData = {
  title: '基础信息',
  formModel: {
    deviceId: '',
    planName: '',
    planPeriodType: '',
    dailyStartTime: '',
    dailyPeriod: '',
    dailySkipDays: [],
    planPeriodTotalValue: '',
    dailyPeriodType: '' // 这个字段单独处理
  },
  formComponent: [{
    type: 'input',
    label: '计划名称',
    model: 'planName',
    keyUpEnter: 'handleFilter',
    rules: [{ required: true, message: '请输入计划名称', trigger: 'blur' }]
  },
  {
    span: 18,
    type: 'select',
    label: '计划周期类别',
    model: 'planPeriodType',
    option: [{ label: '定期', value: '1' }, { label: '日常', value: '0' }],
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  }
  ],
  formComponent2: [{
    span: 5,
    type: 'datePicker',
    label: '计划开始时间',
    model: 'dailyStartTime',
    option: [1, 2, 3],
    rules: [
      { required: true, message: '请输入计划开始时间', trigger: 'blur' }
    ]
  },
  {
    span: 8,
    type: 'selectRadio',
    label: '周期',
    model: 'dailyPeriod',
    defaultValue: 'day',
    unit: 'dailyPeriodType',
    option: [
      { label: '天', value: '0' },
      { label: '周', value: '1' },
      { label: '月', value: '2' }
    ],
    rules: [{ required: true, message: '请输入计划周期', trigger: 'blur' }]
  },
  {
    span: 11,
    type: 'selectCheck',
    label: '跳过日期',
    model: 'dailySkipDays',
    option: [
      { value: '1', label: '周一' },
      { value: '2', label: '周二' },
      { value: '3', label: '周三' },
      { value: '4', label: '周四' },
      { value: '5', label: '周五' },
      { value: '6', label: '周六' },
      { value: '7', label: '周日' }
    ],
    rules: [{ required: true, message: '请输入计划周期', trigger: 'blur' }]
  }
  ],
  formComponent3: [{
    span: 18,
    type: 'dateRangepicker',
    label: '计划时间',
    model: 'regularTime',

    rules: [{ required: true, message: '请输入计划时间', trigger: 'blur' }]
  }]
}
// 档案信息
const operateFormInfo = {
  title: '巡检员',
  formModel: {
    fileTitle: ''
  },
  formComponent: [{
    type: 'select',
    label: '巡检员类别',
    model: 'membType',
    option: [
      { label: '指定人员', value: '0' },
      { label: '指定部门', value: '1' }
    ],
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  },
  {
    type: 'select',
    label: '选择巡检员',
    model: 'userId',
    option: store.state.app.allUser.map(e => {
      return { value: e.value + ',' + e.label, label: e.label }
    }),
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  }
  ],
  formComponent1: [{
    type: 'select',
    label: '巡检员类别',
    model: 'membType',
    option: [
      { label: '指定人员', value: '0' },
      { label: '指定部门', value: '1' }
    ],
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  },
  {
    type: 'select',
    label: '选择指定部门',
    model: 'organId',
    option: store.state.app.allCode.department,
    rules: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
  }
  ]
}
// 整理后的表单配置
const deviceForm0 = [{
  formName: '计划基础信息',
  formRef: 'table1', // 表单ref
  formModel: formData.formModel, // 表单model
  formComponent: formData.formComponent,
  formComponent2: formData.formComponent2,
  formComponent3: formData.formComponent3,
  formName: formData.title // 表单标题
}]
const deviceForm1 = [{
  formName: '计划基础信息',
  formRef: 'table1', // 表单ref
  formModel: formData.formModel, // 表单model
  formComponent: formData.formComponent1,
  formName: formData.title // 表单标题
}]
const operateForm0 = [{
  formName: '巡检员',
  formRef: 'table2', // 表单ref
  formModel: operateFormInfo.formModel, // 表单model
  formComponent: operateFormInfo.formComponent,
  formName: operateFormInfo.title // 表单标题
}]

const operateForm1 = [{
  formName: '巡检员',
  formRef: 'table2', // 表单ref
  formModel: operateFormInfo.formModel, // 表单model
  formComponent: operateFormInfo.formComponent1,
  formName: operateFormInfo.title // 表单标题
}]

const data = {
  basicForm0: deviceForm0,
  basicForm1: deviceForm1,
  operateForm0: operateForm0,
  operateForm1: operateForm1,
  // ----------表单显示相关---------//
  // 计划基本信息
  detailShowInfo: detailShowInfo,
  // 巡检设备
  checkDeviceShowInfo: checkDeviceShowInfo,
  // 巡检员
  checkOperateShowInfo: checkOperateShowInfo,
  // 巡检项
  checkItemsShowInfo: checkItemsShowInfo
}
export default data
